package thread;

public class CurrentThreadDemo {
    public static void main(String[] args) {
        Thread main=Thread.currentThread();//获取当前线程
        System.out.println("主线程是："+main);
        doSome();

   new Thread(){
        public void run() {
            Thread t=Thread.currentThread();
            System.out.println("自定义线程："+t);
            doSome();
        }
    }.start();


    }
    public static void doSome(){
        Thread t=Thread.currentThread();//获取当前线程
        System.out.println("执行doSome方法的线程是"+t);//输出当前线程
    }
}
